﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TestComputer : MonoBehaviour 
{
    public ComputeShader cs;

	// Use this for initialization
	void Start () 
    {
        ComputeBuffer cb = new ComputeBuffer(1000, 4);
        int kernel = cs.FindKernel("CSMain");
        cs.SetBuffer(kernel, "OutValue", cb);
        cs.Dispatch(kernel, 100, 1, 1);
        float[] outvalue = new float[1000];
        cb.GetData(outvalue);
        for(int i = 0 ;i < outvalue.Length;i++)
        {
            Debug.Log( i.ToString() + "  " + outvalue[i].ToString());
        }
    }
	
	// Update is called once per frame
	void Update () {
		
	}
}
